﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.
	Private vptp As Panel
	Private curtecid As Int
	Private ulv As UltimateListView
	Private lstData As List
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layevallist")
	initviews
	
End Sub
Sub initviews
	curtecid=g_store.conf.Get("tecid")
	lstData.Initialize
	comm.setFA(btnleft,"fa-angle-left","")
	Dim nh As Int=150dip
	ulv.DividerHeight=0
	ulv.AddLayout("itemeval","ui_LayoutCreator","eval_ContentFiller",nh,False)
	reqevallistbytecid(curtecid)
	
End Sub
Sub eval_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
	Dim p As Panel=LayoutPanel.GetView(0)
	Dim riv As ImageView=p.GetView(0)
	Dim jqi As Jinqi=lstData.Get(ItemID)
	comm.loadimground(jqi.sendby.img,riv,0,0)
	Dim stuname As Label=p.GetView(1)
	stuname.Text=jqi.sendby.name
	Log(jqi.sendby)
	Dim evaltype As Label=p.GetView(2)
	Select jqi.jqType'好中差
	Case 1
		comm.setFA(evaltype,"fa-heart-o"," 好评")
		evaltype.TextColor=Colors.Red
	Case 2
		comm.setFA(evaltype,"fa-heart-o"," 中评")
		evaltype.TextColor=comm.N_COLOR_ORANGE
	Case 3
		comm.setFA(evaltype,"fa-heart-o"," 差评")
		evaltype.TextColor=Colors.Gray
	End Select
	Dim school As Label=p.GetView(3)
	school.Text=jqi.sendby.city&" "&jqi.sendby.school&" "&jqi.sendby.grade
	Dim ratestr As Label=p.GetView(4)
	ratestr.Text=jqi.evalStr
End Sub
Sub ui_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
	LayoutPanel.LoadLayout(LayoutName)
End Sub
Sub reqevallistbytecid(tecid As Int)
	comm.showProgress("正在获取评价列表")
	ParseHelper.doGetReq(Me,"evallst",comm.getApi(comm.apiIdx.REQEVALLISTBYTEACHER),Array As String("js_id",tecid))
End Sub
Sub parseevallist(str As String)
	Dim parser As JSONParser 
	parser.Initialize(str) 
	Dim root As Map = parser.NextObject 
	Dim data As List = root.Get("data") 
	lstData.Clear
	For Each coldata As Map In data 
	    Dim image As String = coldata.Get("image") 
	    Dim comment_xj As String = coldata.Get("comment_xj") 
	    Dim city As String = coldata.Get("city") 
	    Dim comment_addtime As String = coldata.Get("comment_addtime") 
	    Dim usertel As String = coldata.Get("usertel") 
	    Dim comment_id As String = coldata.Get("comment_id") 
	    Dim nianji As String = coldata.Get("nianji") 
	    Dim hy_school As String = coldata.Get("hy_school") 
	    Dim comment_huifu_id As String = coldata.Get("comment_huifu_id") 
	    Dim kc_id As String = coldata.Get("kc_id") 
	    Dim children As String = coldata.Get("children") 
	    Dim comment_type As String = coldata.Get("comment_type") 
	    Dim comment_content As String = coldata.Get("comment_content") 
	    Dim id As String = coldata.Get("id") 
	    Dim username As String = coldata.Get("username") 
		Dim jqi As Jinqi
		jqi.Initialize
		jqi.evalStr=comment_content
		jqi.jqType=comment_type
		jqi.sendby.Initialize
		jqi.sendby.img=comm.combinPic(image)
		jqi.sendby.name=username
		jqi.sendby.school=hy_school
		jqi.sendby.grade=nianji
		jqi.sendby.city=city
		jqi.sDate=comment_addtime
		lstData.Add(jqi)
		ulv.AddItem("itemeval",lstData.Size-1)
	Next 
	Dim status As String = root.Get("status") 

End Sub
Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		Select thj.JobName.ToLowerCase
		Case "evallst"
			If nr.nCode=200 Then
				parseevallist(str)
			Else
				comm.TL("获取评价列表错误:"&nr.sData)
			End If
		End Select
	Else
		comm.TL("网络错误:"&thj.JobName&thj.ErrorMessage)
	End If
	thj.Release
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ivback_Click
	Activity.Finish
End Sub

Sub vpager_PageChanged (Position As Int)
	Log(Position)
End Sub